package com.wangshouyu.mp.pay.common.enums;

/**
 * @author 王守钰
 * @description 签名类型
 * @date 2020/8/13 9:44
 */
public enum SignType {

    /**
     * MD5
     */
    MD5("MD5"),

    /**
     * HMACSHA256
     */
    HMAC_SHA256("HMAC-SHA256"),

    /**
     * RSA
     */
    RSA("RSA");

    private String type;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    SignType(String type) {
        this.type = type;
    }

    /**
     * 根据类型获取签名
     * @param type
     * @return
     */
    public static SignType getByType(String type){
        for(SignType signType : SignType.values()){
            if(signType.getType().equalsIgnoreCase(type)){
                return signType;
            }
        }
        return null;
    }
}
